;; make topography file for Jablonowski & Williamson (2006) dynamical core test

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

fname="./orog_lsm_alb.t30.grd"

nlat=48
nlon=96

UNDEF=9.999E+19
setfileoption("bin","ReadByteOrder","BigEndian")
;; set coordinates
gau_info=gaus(nlat/2)
lat=tofloat(gau_info(::-1,0))
dlon=360./nlon
lon=dlon*ispan(0,nlon-1,1)

;; read orography 
gh =fbinrecread(fname, 0, (/nlat,nlon/), "float")
gh!0="lat"
gh!1="lon"
gh&lat=lat
gh&lon=lon
;; read land-sea mask
lsm=fbinrecread(fname, 1, (/nlat,nlon/), "float")
copy_VarCoords(gh,lsm)
;; read albedo
alb=fbinrecread(fname, 2, (/nlat,nlon/), "float")
copy_VarCoords(gh,alb)

fo=addfile("orog_lsm_alb.t30.nc","c")
fo->gh=gh
fo->lsm=lsm
fo->alb=alb
